package com.hk.springtrains.jms.send;

import com.hongkang.springtrains.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Component;

@Component
public class SendBehaviorImpl implements SendBehavior {

    @Autowired
    private JmsTemplate jmsTemplate ;

    @Override
    public void sendUserInfo(User user) {
        System.out.println(user);
        //jmsTemplate.send((session)-> session.createObjectMessage(user));
        jmsTemplate.convertAndSend(user);
    }
}
